<?php echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	dir="<?php echo $direction; ?>" lang="<?php echo $lang; ?>"
	xml:lang="<?php echo $lang; ?>">
<head>
<title><?php echo $title; ?></title>
<base href="<?php echo $base; ?>" />
<?php if ($description) { ?>
<meta name="description" content="<?php echo $description; ?>" />
<?php } ?>
<?php if ($keywords) { ?>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<?php } ?>
<?php foreach ($links as $link) { ?>
<link href="<?php echo $link['href']; ?>"
	rel="<?php echo $link['rel']; ?>" />
<?php } ?>
<link rel="stylesheet" type="text/css"
	href="view/stylesheet/stylesheet.css" />
<?php foreach ($styles as $style) { ?>
<link rel="<?php echo $style['rel']; ?>" type="text/css"
	href="<?php echo $style['href']; ?>"
	media="<?php echo $style['media']; ?>" />
<?php } ?>
<script type="text/javascript"
	src="view/javascript/jquery/jquery-1.6.1.min.js"></script>
<script type="text/javascript"
	src="view/javascript/jquery/ui/jquery-ui-1.8.16.custom.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="view/javascript/jquery/ui/themes/ui-lightness/jquery-ui-1.8.16.custom.css" />
<script type="text/javascript"
	src="view/javascript/jquery/ui/external/jquery.bgiframe-2.1.2.js"></script>
<script type="text/javascript" src="view/javascript/jquery/tabs.js"></script>
<script type="text/javascript"
	src="view/javascript/jquery/superfish/js/superfish.js"></script>
<?php foreach ($scripts as $script) { ?>
<script type="text/javascript" src="<?php echo $script; ?>"></script>
<?php } ?>
<script type="text/javascript">
//-----------------------------------------
// Confirm Actions (delete, uninstall)
//-----------------------------------------
$(document).ready(function(){
    // Confirm Delete
    $('#form').submit(function(){
        if ($(this).attr('action').indexOf('delete',1) != -1) {
            if (!confirm('<?php echo $text_confirm; ?>')) {
                return false;
            }
        }
    });
    	
    // Confirm Uninstall
    $('a').click(function(){
        if ($(this).attr('href') != null && $(this).attr('href').indexOf('uninstall', 1) != -1) {
            if (!confirm('<?php echo $text_confirm; ?>')) {
                return false;
            }
        }
    });
});
</script>
</head>
<body>
<div id="container">
<div id="header">
<div class="div1">
<div class="div2"><img src="view/image/logo.png"
	title="<?php echo $heading_title; ?>"
	onclick="location = '<?php echo $home; ?>'" /></div>

<?php if ($logged) { ?>
<div class="div3"><img src="view/image/lock.png" alt=""
	style="position: relative; top: 3px;" />&nbsp;<?php echo $logged; ?></div>
<?php } ?></div>
<?php if ($logged) { ?>
<div id="menu">
<ul class="left" style="display: none;">
	<li id="home"><a href="<?php echo $home; ?>" class="top"><?php echo $text_home; ?></a></li>

	<?php
	// RESTAURANT
	if ($this->user->hasPermission('access', 'restaurant/restaurant')
	|| $this->user->hasPermission('access', 'restaurant/restaurant_option')
	|| $this->user->hasPermission('access', 'menu/food_option')
	|| $this->user->hasPermission('access', 'menu/attribute')
	|| $this->user->hasPermission('access', 'menu/attribute_group')
	|| $this->user->hasPermission('access', 'restaurant/setting')
	|| $this->user->hasPermission('access', 'restaurant/staff')
	|| $this->user->hasPermission('access', 'menu/food')
	|| $this->user->hasPermission('access', 'restaurant/review')
	|| $this->user->hasPermission('access', 'menu/review')
	) {
		?>
	<li id="restaurant"><a class="top"><?php echo $text_restaurant; ?></a>
	<ul>
	<?php
	if ($this->user->hasPermission('access', 'restaurant/restaurant')) {
		?>
		<li><a href="<?php echo $restaurant_restaurant; ?>"><?php echo $text_restaurant; ?></a></li>
		<?php
	}
	?>
	<?php
	if ($this->user->hasPermission('access', 'restaurant/setting')) {
		?>
		<li><a href="<?php echo $restaurant_config; ?>"><?php echo $text_restaurant_config; ?></a></li>
		<?php
	}
	?>
	<?php
	if ($this->user->hasPermission('access', 'restaurant/restaurant_option')) {
		?>
		<li><a href="<?php echo $restaurant_option; ?>"><?php echo $text_restaurant_option; ?></a></li>
		<?php
	}
	?>
	<?php
	if ($this->user->hasPermission('access', 'menu/food_option')) {
		?>
		<li><a href="<?php echo $restaurant_menu_option; ?>"><?php echo $text_food_option; ?></a></li>
		<?php
	}
	?>
	<?php
	if ($this->user->hasPermission('access', 'menu/attribute')
	|| $this->user->hasPermission('access', 'menu/attribute_group')
	) {
		?>
		  <li><a class="parent"><?php echo $text_attribute; ?></a>
            <ul>
              <?php
			  if ($this->user->hasPermission('access', 'menu/attribute')) {
		   	  ?>
	              <li><a href="<?php echo $attribute; ?>"><?php echo $text_attribute; ?></a></li>
			  <?php
			  }
			  ?>
              <?php
			  if ($this->user->hasPermission('access', 'menu/attribute_group')) {
		   	  ?>
	              <li><a href="<?php echo $attribute_group; ?>"><?php echo $text_attribute_group; ?></a></li>
			  <?php
			  }
			  ?>
            </ul>
          </li>
		<?php
	}
	?>
	<?php
	if ($this->user->hasPermission('access', 'restaurant/staff')) {
		?>
		<li><a href="<?php echo $restaurant_staff; ?>"><?php echo $text_restaurant_staff; ?></a></li>
		<?php
	}
	?>
	<?php
	if ($this->user->hasPermission('access', 'menu/food')
	|| $this->user->hasPermission('access', 'menu/menu')
	|| $this->user->hasPermission('access', 'menu/review')
	) {
		?>
		<li><a class="parent" href="<?php echo $restaurant_menu; ?>"><?php echo $text_menu; ?></a>
		<ul>
		<?php
		if ($this->user->hasPermission('access', 'menu/menu')) {
			?>
			<li><a href="<?php echo $restaurant_menu_category; ?>"><?php echo $text_menu; ?></a></li>
			<?php
		}
		?>
		<?php
		if ($this->user->hasPermission('access', 'menu/food')) {
			?>
			<li><a href="<?php echo $restaurant_menu; ?>"><?php echo $text_food; ?></a></li>
			<?php
		}
		?>
		<?php
		if ($this->user->hasPermission('access', 'menu/review')) {
			?>
			<li><a href="<?php echo $food_review; ?>"><?php echo $text_review; ?></a></li>
			<?php
		}
		?>
		</ul>
		</li>
		<?php
	}
	?>
	<?php
	if ($this->user->hasPermission('access', 'restaurant/review')) {
		?>
		<li><a href="<?php echo $review; ?>"><?php echo $text_review; ?></a></li>
		<?php
	}
	?>
	</ul>
	</li>
	<?php
	}
	?>

	<?php
	// SALE
	if ($this->user->hasPermission('access', 'sale/order')
	|| $this->user->hasPermission('access', 'restaurant/booking')
	|| $this->user->hasPermission('access', 'sale/coupon')
	|| $this->user->hasPermission('access', 'sale/customer')
	|| $this->user->hasPermission('access', 'sale/customer_group')
	|| $this->user->hasPermission('access', 'sale/contact')
	|| $this->user->hasPermission('access', 'sale/voucher')
	|| $this->user->hasPermission('access', 'sale/voucher_theme')
	) {
		?>
	<li id="sale"><a class="top"><?php echo $text_sale; ?></a>
	<ul>
	<?php
	if ($this->user->hasPermission('access', 'sale/order')) {
		?>
		<li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>
		<?php
	}
	?>

	<?php
	if ($this->user->hasPermission('access', 'restaurant/booking')) {
		?>
		<li><a href="<?php echo $restaurant_booking; ?>"><?php echo $text_restaurant_booking; ?></a></li>
		<?php
	}
	?>

	<?php
	if ($this->user->hasPermission('access', 'sale/coupon')) {
		?>
		<li><a href="<?php echo $coupon; ?>"><?php echo $text_coupon; ?></a></li>
		<?php
	}
	?>

	<?php
	// SALE - CUSTOMER
	if ($this->user->hasPermission('access', 'sale/customer')
	|| $this->user->hasPermission('access', 'sale/customer_group')
	) {
		?>
		<li><a class="parent"><?php echo $text_customer; ?></a>
		<ul>
		<?php
		if ($this->user->hasPermission('access', 'sale/customer')) {
			?>
			<li><a href="<?php echo $customer; ?>"><?php echo $text_customer; ?></a></li>
			<?php
		}
		?>
		<?php
		if ($this->user->hasPermission('access', 'sale/customer_group')) {
			?>
			<li><a href="<?php echo $customer_group; ?>"><?php echo $text_customer_group; ?></a></li>
			<?php
		}
		?>
		</ul>
		</li>
		<?php
	}
	?>

	<?php
	if ($this->user->hasPermission('access', 'sale/voucher')
	|| $this->user->hasPermission('access', 'sale/voucher_theme')
	) {
		?>
		<li><a class="parent"><?php echo $text_voucher; ?></a>
		<ul>
		<?php
		if ($this->user->hasPermission('access', 'sale/voucher')) {
			?>
			<li><a href="<?php echo $voucher; ?>"><?php echo $text_voucher; ?></a></li>
			<?php
		}
		?>
		<?php
		if ($this->user->hasPermission('access', 'sale/voucher_theme')) {
			?>
			<li><a href="<?php echo $voucher_theme; ?>"><?php echo $text_voucher_theme; ?></a></li>
			<?php
		}
		?>
		</ul>
		</li>
		<?php
	}
	?>

	<?php
	if ($this->user->hasPermission('access', 'sale/contact')) {
		?>
		<li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
		<?php
	}
	?>
	</ul>
	</li>
	<?php
	}
	?>

	<?php
	// CONTENTS
	if ($this->user->hasPermission('access', 'news/article')
	|| $this->user->hasPermission('access', 'news/category')
	|| $this->user->hasPermission('access', 'content/banner')
	|| $this->user->hasPermission('access', 'content/information')
	) {
	?>
	<li id="contents"><a class="top"><?php echo $text_content; ?></a>
	<ul>
		<?php
		// INFORMATION
		if ($this->user->hasPermission('access', 'content/information')
		) {
		?>	
		<li><a href="<?php echo $information; ?>"><?php echo $text_information; ?></a></li>
		<?php 
		}
		?>
		
		<?php
		// NEWS
		if ($this->user->hasPermission('access', 'news/article')
		|| $this->user->hasPermission('access', 'news/category')
		) {
		?>
		<li id="news"><a class="parent"><?php echo $text_news; ?></a>
		<ul>
			<?php
			if ($this->user->hasPermission('access', 'news/category')) {
				?>
				<li><a href="<?php echo $news_category; ?>"><?php echo $text_news_category; ?></a></li>
				<?php
			}
			?>
			<?php
			if ($this->user->hasPermission('access', 'news/article')) {
				?>
				<li><a href="<?php echo $news_article; ?>"><?php echo $text_news; ?></a></li>
				<?php
			}
			?>
		</ul>
		</li>		
		<?php
		}
		?>
		
		<?php
		// BANNER
		if ($this->user->hasPermission('access', 'content/banner')
		) {
		?>
		<li id="banner"><a href="<?php echo $banner; ?>"><?php echo $text_banner; ?></a></li>
		<?php
		}
		?>
	</ul>
	</li>
	<?php
	}
	?>

	<?php
	// EXTENSION
	if ($this->user->hasPermission('access', 'extension/module')
	|| $this->user->hasPermission('access', 'extension/shipping')
	|| $this->user->hasPermission('access', 'extension/payment')
	|| $this->user->hasPermission('access', 'extension/total')
	) {
		?>
	<li id="extension"><a class="top"><?php echo $text_extension; ?></a>
	<ul>
	<?php
	if($this->user->hasPermission('access', 'extension/module')){
		?>
		<li><a href="<?php echo $module; ?>"><?php echo $text_module; ?></a></li>
		<?php
	}
	?>
	<?php
	if($this->user->hasPermission('access', 'extension/shipping')){
		?>
		<li><a href="<?php echo $shipping; ?>"><?php echo $text_shipping; ?></a></li>
		<?php
	}
	?>
	<?php
	if($this->user->hasPermission('access', 'extension/payment')){
		?>
        <li><a href="<?php echo $payment; ?>"><?php echo $text_payment; ?></a></li>
		<?php
	}
	?>
	<?php
	if($this->user->hasPermission('access', 'extension/total')){
		?>
        <li><a href="<?php echo $total; ?>"><?php echo $text_total; ?></a></li>
		<?php
	}
	?>
	</ul>
	</li>
	<?php
	}
	?>

	<?php
	// SETTING
	if ($this->user->hasPermission('access', 'setting/setting')
	|| $this->user->hasPermission('access', 'setting/template')
	|| $this->user->hasPermission('access', 'setting/layout')
	|| $this->user->hasPermission('access', 'setting/user')
	|| $this->user->hasPermission('access', 'setting/user_permission')
	|| $this->user->hasPermission('access', 'setting/language')
	|| $this->user->hasPermission('access', 'setting/currency')
	|| $this->user->hasPermission('access', 'setting/booking_status')
	|| $this->user->hasPermission('access', 'setting/order_status')
	|| $this->user->hasPermission('access', 'setting/tax_class')
	|| $this->user->hasPermission('access', 'setting/tax_rate')
	|| $this->user->hasPermission('access', 'setting/error_log')
	|| $this->user->hasPermission('access', 'setting/backup')
	) {
		?>
	<li id="system"><a class="top"><?php echo $text_system; ?></a>
	<ul>
		<li><a href="<?php echo $setting; ?>"><?php echo $text_setting; ?></a></li>
		<li><a class="parent"><?php echo $text_design; ?></a>
		<ul>
			<li><a href="<?php echo $template; ?>"><?php echo $text_template; ?></a></li>
			<li><a href="<?php echo $layout; ?>"><?php echo $text_layout; ?></a></li>
		</ul>
		</li>
		<li><a class="parent"><?php echo $text_users; ?></a>
		<ul>
			<li><a href="<?php echo $user; ?>"><?php echo $text_user; ?></a></li>
			<li><a href="<?php echo $user_group; ?>"><?php echo $text_user_group; ?></a></li>
		</ul>
		</li>
		<li><a class="parent"><?php echo $text_localisation; ?></a>
		<ul>
			<li><a href="<?php echo $language; ?>"><?php echo $text_language; ?></a></li>
			<li><a href="<?php echo $currency; ?>"><?php echo $text_currency; ?></a></li>
			<li><a href="<?php echo $booking_status; ?>"><?php echo $text_booking_status; ?></a></li>
			<li><a href="<?php echo $order_status; ?>"><?php echo $text_order_status; ?></a></li>
		</ul>
		</li>
		<li><a href="<?php echo $error_log; ?>"><?php echo $text_error_log; ?></a></li>
		<li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li>
	</ul>
	</li>
	<?php
	}
	?>

	<?php
	// REPORT
	if ($this->user->hasPermission('access', 'report/sale_restaurant')
	) {
		?>
	<li id="reports"><a class="top"><?php echo $text_reports; ?></a>
	<ul>
	<?php
	if($this->user->hasPermission('access', 'report/sale_restaurant')){
		?>
		<li><a href="#"><?php echo $text_report_sale_restaurant; ?></a></li>
		<?php
	}
	?>
	</ul>
	</li>
	<?php
	}
	?>
</ul>
<ul class="right">
	<li id="restaurant"><a href="#" class="top"><?php echo $current_restaurant; ?></a>
	</li>
	<li id="restaurant"><a class="top" href="<?php echo $logout; ?>"><?php echo $text_logout; ?></a></li>
</ul>
<script type="text/javascript"><!--
$(document).ready(function() {
	$('#menu > ul').superfish({
		hoverClass	 : 'sfHover',
		pathClass	 : 'overideThisToUse',
		delay		 : 0,
		animation	 : {height: 'show'},
		speed		 : 'normal',
		autoArrows   : false,
		dropShadows  : false, 
		disableHI	 : false, /* set to true to disable hoverIntent detection */
		onInit		 : function(){},
		onBeforeShow : function(){},
		onShow		 : function(){},
		onHide		 : function(){}
	});
	
	$('#menu > ul').css('display', 'block');
});
 
function getURLVar(urlVarName) {
	var urlHalves = String(document.location).toLowerCase().split('?');
	var urlVarValue = '';
	
	if (urlHalves[1]) {
		var urlVars = urlHalves[1].split('&');

		for (var i = 0; i <= (urlVars.length); i++) {
			if (urlVars[i]) {
				var urlVarPair = urlVars[i].split('=');
				
				if (urlVarPair[0] && urlVarPair[0] == urlVarName.toLowerCase()) {
					urlVarValue = urlVarPair[1];
				}
			}
		}
	}
	
	return urlVarValue;
} 

$(document).ready(function() {
	route = getURLVar('route');
	
	if (!route) {
		$('#dashboard').addClass('selected');
	} else {
		part = route.split('/');
		
		url = part[0];
		
		if (part[1]) {
			url += '/' + part[1];
		}
		
		$('a[href*=\'' + url + '\']').parents('li[id]').addClass('selected');
	}
});
//--></script></div>
	<?php } ?></div>